package com.letfox.finance.controller.finance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.letfox.common.model.ResultResponse;
import com.letfox.finance.controller.BaseController;
import com.letfox.finance.service.ADPlanFINIncomeService;

@Controller
@RequestMapping(value = "/frmPlan")
public class ADPlanFINIncomeController extends BaseController{
	
	@Autowired
	private ADPlanFINIncomeService adPlanFINIncomeService;
	
	@RequestMapping(value = "/selectFrmPlan",method=RequestMethod.POST)
	@ResponseBody
	public ResultResponse selectFrmPlan(@RequestParam String planId,
			@RequestParam String startCreateTime,
			@RequestParam String endCreateTime){
		try {
			resultResponse=adPlanFINIncomeService.selectPlanFim(planId, startCreateTime, endCreateTime);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			ResultResponse.getFailInstance(e);
		}
		return resultResponse;
	}
	
	@RequestMapping(value = "/addPlanFrm",method=RequestMethod.POST)
	@ResponseBody
	public ResultResponse addPlanFrm(@RequestParam String adServingId,
			@RequestParam String finOutcomeId){
		try {
			resultResponse=adPlanFINIncomeService.addPlanFim(adServingId, finOutcomeId);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			ResultResponse.getFailInstance(e);
		}
		return resultResponse;
	}

}
